Is your car's computer doing input and output?

A good answer might be:

Yes—data is input from sensors, computations are performed, and the results are output to controllers.

IO Streams

If the car's computer program were written in Java, it would use a specialized IO package that manages sensors and controllers. It would not use the IO package that deals with keyboards and terminals.

In Java, a source of input data is called an input stream and the output data is called an output stream. Think of these streams like this:

In this picture, each "O" is supposed to be a datum (chunk of data) waiting in line to be input, or leaving as output. Inputting data is usually called reading data; and outputting data is usually called writing data (or printing data if the output stream is connected to a monitor or a printer.)

You might think of the input stream as a string of pearls which the program inputs one at a time, in order. The output stream is a string of new pearls (not usually the same ones as came in.) Often a program will have to input several data in a row before it has enough to process. For example, the input data might be a list of numbers, the output data might be their sum.

In general, a program may have several input streams flowing into it and several output streams flowing out of it. For most of the programs in these notes, there are three IO streams:

Normally System.in is connected to the keyboard and the data are characters. System.out and System.err both are connected to the monitor, and also are character data. These streams are difficult to manage by themselves. We will use the package java.io to help.

QUESTION 3:

What does the keyboard send to your program when you type the following:

1234